import java.awt.Graphics;

/**
 * project5
 *
 * brief description of the program
 *
 * This program is released to public domain according to
 * author's wish, you can view full license at
 * http://tomatoeskit.org/upload/PublicDomainLicense.txt
 *
 * @author Fangning CHENG (Alpha.L Cheng) <chengf@purdue.edu>
 *
 * @lab section number 
 *
 * @date Oct 21, 2013
 *
 */

public class Pentagon implements Shape {
    private int centerX;
    private int centerY;
    private int radius;
    private final int rc18;
    private final int rs18;
    private final int rc54;
    private final int rs54;
    
    Pentagon(int cX, int cY, int r)
    {
        centerX = cX;
        centerY = cY;
        radius  = r;
        
        rc18 = (int) (r * Math.cos(Math.toRadians(18)));
        rs18 = (int) (r * Math.sin(Math.toRadians(18)));
        rc54 = (int) (r * Math.cos(Math.toRadians(36)));
        rs54 = (int) (r * Math.sin(Math.toRadians(36)));
    }
    
    public void draw(Graphics g)
    {
        int x[] = new int[] {centerX,           centerX + rc18, 
                             centerX + rs54,    centerX -  rs54, 
                             centerX - rc18};
        
        int y[] = new int[] {centerY - radius,  centerY - rs18,
                             centerY + rc54,    centerY + rc54,
                             centerY - rs18};
        g.drawPolygon(x, y, 5);
    }
}
